package com.example.demo.entity;

import java.util.Date;

public class Post {
    private Long postId;         // 10位唯一帖子ID(首位为1)
    private String title;        // 帖子标题
    private Long authorId;       // 发布者用户ID
    private String content;      // 帖子内容
    private Date createTime;     // 创建时间
    private Integer likeCount;   // 点赞数
    private Integer commentCount; // 评论数

    // 构造方法
    public Post() {
    }

    public Post(Long postId, String title, Long authorId, String content) {
        this.postId = postId;
        this.title = title;
        this.authorId = authorId;
        this.content = content;
        this.createTime = new Date();
        this.likeCount = 0;
        this.commentCount = 0;
    }

    // Getter和Setter方法
    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Long getAuthorId() {
        return authorId;
    }

    public void setAuthorId(Long authorId) {
        this.authorId = authorId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Integer getLikeCount() {
        return likeCount;
    }

    public void setLikeCount(Integer likeCount) {
        this.likeCount = likeCount;
    }

    public Integer getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Integer commentCount) {
        this.commentCount = commentCount;
    }

    @Override
    public String toString() {
        return "Post{" +
                "postId=" + postId +
                ", title='" + title + '\'' +
                ", authorId=" + authorId +
                ", content='" + content + '\'' +
                ", createTime=" + createTime +
                ", likeCount=" + likeCount +
                ", commentCount=" + commentCount +
                '}';
    }
}